package com.atguigu.day26.connection01;

import org.junit.Test;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * @version 1.0
 * @Author 马冰
 * @Date 2024/12/3 10:33
 * @注释
 */
public class ConnectionTest {
    @Test
    public void test01() throws Exception {
        //注册驱动
        Class.forName("com.mysql.cj.jdbc.Driver");
        //建立连接
        String url = "jdbc:mysql://localhost:3306/atguigu";
        Connection connection = DriverManager.getConnection(url,"root","1234");
        System.out.println(connection);
        //关闭资源
        connection.close();
    }


}
